import { GEtHOMEDAT,GEtGOODDAT } from "./contains";
import { getHotCatApi,getGoodApi } from "@api/homeApi";
//同步action
const GEtHOMEDATSync=(arr)=>{
  return{
    type:GEtHOMEDAT,
    arr
  }
}
const GEtGOODDATSync=(arr)=>{
  return{
    type:GEtGOODDAT,
    arr
  }
}
//异步action
const GetHomeAsync=()=>{
  return (dispatch)=>{
    //放异步代码
    getHotCatApi().then(res=>{
      dispatch(GEtHOMEDATSync(res.data))
    })
  }
}
const GEtGOODDATAsync=()=>{
  return (dispatch)=>{
    //放异步代码
    getGoodApi().then(res=>{
      dispatch(GEtGOODDATSync(res.data))
    })
    
  }
}
export {
  GetHomeAsync,
  GEtGOODDATAsync
}